<div id="txt">
<p>Her kan du skrive inn start- og endeposisjon, så vil nettsiden automatisk generere reiserute for deg. Passeringstidspunk for de ulike byene blir automatisk generet ut i fra en gjennomsnittshastighet på 62 km/t.</p>
<p>I tillegg til å vise været for angitt startposisjon, vises det hvordan ruten ville sett ut om man startet to, fire, seks eller åtte timer senere.</p>
<p>Senere versjoner vil ha transpotsmiddel-valg også, for eksempel bil/sykkel/gange.</p>
</div>

{if isset($step1)}
<p class="tab" id="tabActive">Steg 1</p><p class="tab">Steg 2</p><p class="tab">Steg 3</p>
<div class="clear"> </div>

<p>Oppgi ønsket rute</p>
<form action="" method="post" id="step1">
  <div>
	<input type="text" id="from" name="from" /><label for="from">Fra</label>
	<input type="text" id="to" name="to" /><label for="to">Til</label>
	<input type="submit" value="Lag rute" />
  </div>
</form>
	
{elseif isset($step2)}
	<p class="tab"><a href="?page=route">Steg 1</a></p><p class="tab" id="tabActive">Steg 2</p><p class="tab">Steg 3</p>
	<div class="clear"> </div>
	<p id="redbox">Vennligst vent til Europa-kartet nedenfor har dukket opp, før du velger dag/klokkeslett</p>
	
	<form action="?page=route" name="byer" method="post" id="step2">
        <div class="color">
      
      	<table>
			<tr>
				<td class="space">Tid</td>
			{section name="foo" loop=7}
				<td  class="day">{$date->format('D')}</td>
				{$date->modify('+1 day')}
			{/section}
			</tr>
			<tr>
				<td></td>
			{$date->modify('-7 day')}
			{section name="cal" loop=7}
				<td class="day2"><input type="radio" name="date" value="{$smarty.section.cal.index}"{if $smarty.section.cal.index==1}checked="checked"{/if} /></td>
				{$date->modify('+1 day')}
			{/section}	
			</tr>
		</table>
	  </div>
	  <div class="color">
		<label for="besk">Klokkeslett</label>
		<select name="time">
		<option>Velg tidspunkt</option>
		{section name="hour" loop="24"}
			{assign var="time" value=$smarty.section.hour.index}
			<option value="{$time}" onclick="startRouting()">{if $time<10}0{/if}{$time}:00</option>
		{/section}
		</select>       	
	   </div>
	  <div class="color">
	  	<input type="hidden" value="{$from}" name="start" id='start' />
      	<div id="routeDescription"><!-- cities --></div>
      	<input type="hidden" value="{$to}" name="end" id='destination' />
      	<input type="submit" value="Vis værmelding" id="getWeather" disabled="disabled" />
      	<span id='loading'></span>
      
      </div>
    </form>

	<div id="maparea" style="width:700px;height:500px;background-color:#E0E0E0;"> </div>
	 	  
	 	  
{elseif isset($step3)}
<p class="tab"><a href="?page=route">Steg 1</a></p><p class="tab">Steg 2</p><p class="tab" id="tabActive">Steg 3</p>
<div id="step3">

{assign var='weatherSum1' value=0} {assign var='weatherSum2' value=0} {assign var='weatherSum3' value=0} {assign var='weatherSum4' value=0} {assign var='weatherSum5' value=0}
{if isset($route)}

{foreach from=$route->getPlaceArray() item="place" name="bar"}
	<div class="forecast-day">
		{if $xmlDate != $place->getNiceDate()}
			{$place->setDayIndex($days_ahead+1)}
		{else}
			{$place->setDayIndex($days_ahead)}
		{/if}
		
		{*{$place->setHour($hour_ahead)}*}
		{section name="lokke" loop=10 step=2}
			{if $smarty.section.lokke.index==0}
				{assign var='dayX' value=$day}
			{else}
				{assign var='dayX' value=$place->addHour(2)+$day}
				{assign var='day' value=$dayX} 
			{/if}
			{assign var='weather' value=$place->getForecast($place->getDayIndex(),$place->getHour())}
			<div class="forecast-box">
				<h3>{$place->getName()}{if $smarty.foreach.bar.index == 0}
					, start kl {$place->getNiceHour()}
					{else}, {$place->getNiceDistance()} km
					{/if}</h3>
				<h4>{$place->getNiceDate()} kl {$place->getNiceHour()}.00</h4>
				<table>
					<tbody>
						<tr>
							<td class="w-icon">
								{assign var='symbol' value=$weather->getFirsWeatherSymbol()}
								<img src={$place->getSymbolString($symbol) alt='vær {$symbol}' />
								{if $smarty.section.lokke.index==0}
									{assign var='weatherSum1' value=$weatherSum1+$symbol}
								{elseif $smarty.section.lokke.index==2}
									{assign var='weatherSum2' value=$weatherSum2+$symbol}
								{elseif $smarty.section.lokke.index==4}
									{assign var='weatherSum3' value=$weatherSum3+$symbol}
								{elseif $smarty.section.lokke.index==6}
									{assign var='weatherSum4' value=$weatherSum4+$symbol}
								{elseif $smarty.section.lokke.index==8}
									{assign var='weatherSum5' value=$weatherSum5+$symbol}
								{else} ØHH.. 
								{/if}	
							</td>
							{if $weather->getTemperature()>0}
								<td class="plus">{$weather->getTemperatureRound()}&deg;</td>
							{/if}
							{if $weather->getTemperature()<=0}
								<td class="minus">{$weather->getTemperatureRound()}&deg;</td>
							{/if}
							<td class="wind">
								<img src='http://www.yr.no/grafikk/pil.aspx?r={$weather->getWindDir()}&h={$weather->getWindSpeed()}' />
							</td>
						</tr>
					</tbody>
				</table>
				<p>{$weather->getWindSpeedTxt()}, fra {$weather->getWindDirTxt()}. {$weather->getPrecipitation()} mm nedbør.</p>
			</div>
		{/section}
	</div>
{/foreach}

{if $weatherSum1>0}
{assign var='smaal' value=$place->getNumber($weatherSum1,$weatherSum2,$weatherSum3,$weatherSum4,$weatherSum5)}
<div class="best-box">
	{if $weatherSum1==$smaal} <p>Penest vær</p>{/if}
</div>
<div class="best-box">
	{if $weatherSum2==$smaal} <p>Penest vær</p>{/if}
</div>
<div class="best-box">
	{if $weatherSum3==$smaal} <p>Penest vær</p>{/if}
</div>
<div class="best-box">
	{if $weatherSum4==$smaal} <p>Penest vær</p>{/if}
</div>
<div class="best-box">
	{if $weatherSum5==$smaal} <p>Penest vær</p>{/if}
</div>
{/if}
</div>
{/if}

{*

{if isset($route)}
	<h2>{$route->getStartPlace()} - {$route->getEndPlace()}</h2>

	<p>$route->getPlace()->getForecast([{$days_ahead}][{$hour_ahead}])</p>

	<ol>
		{foreach from=$route->getPlaceArray() item="place" name="placeItr"}
		{assign var='passby' value=$place->getHour()}
		{assign var='weather' value=$place->getForecast($days_ahead,$hour_ahead,true)}
		<li>
			{foreach from=$weather->getWeatherSymbols() item="symbol"}
				<img src={$place->getSymbolString($symbol)} alt='vær {$symbol}' />
			{/foreach}
			<h3>{$place->getName()}</h3> ({$place->getDistance()} km)
			<p>{$weather->getTemperature()} &deg;C</p>
			<p>{$weather->getWindSpeed()} m/s ({$weather->getWindDir()}&deg; retning)</p>
			<p>Værdata for kl {$passby}.00</p>
					
		</li>
			{/foreach}
	</ol>
{else}Ingen treff, prøv på nytt
{/if}
</div>
*}

{/if}

